/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entidade.persistencia;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author victorinox
 */
@Entity
@Table(name = "operacao_extra_tipo", catalog = "carlossa03", schema = "")
@NamedQueries({@NamedQuery(name = "OperacaoExtraTipo.findAll", query = "SELECT o FROM OperacaoExtraTipo o"), @NamedQuery(name = "OperacaoExtraTipo.findByOperacaoExtraTipoId", query = "SELECT o FROM OperacaoExtraTipo o WHERE o.operacaoExtraTipoId = :operacaoExtraTipoId"), @NamedQuery(name = "OperacaoExtraTipo.findByNome", query = "SELECT o FROM OperacaoExtraTipo o WHERE o.nome = :nome")})
public class OperacaoExtraTipo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "operacao_extra_tipo_id")
    private Integer operacaoExtraTipoId;
    @Basic(optional = false)
    @Column(name = "nome")
    private String nome;
    @Basic(optional = false)
    @Column(name = "descricao")
    private String descricao;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "operacaoExtraTipoId")
    private List<OpercaoExtra> opercaoExtraCollection;

    public OperacaoExtraTipo() {
    }

    public OperacaoExtraTipo(Integer operacaoExtraTipoId) {
        this.operacaoExtraTipoId = operacaoExtraTipoId;
    }

    public OperacaoExtraTipo(Integer operacaoExtraTipoId, String nome, String descricao) {
        this.operacaoExtraTipoId = operacaoExtraTipoId;
        this.nome = nome;
        this.descricao = descricao;
    }

    public Integer getOperacaoExtraTipoId() {
        return operacaoExtraTipoId;
    }

    public void setOperacaoExtraTipoId(Integer operacaoExtraTipoId) {
        this.operacaoExtraTipoId = operacaoExtraTipoId;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public List<OpercaoExtra> getOpercaoExtraCollection() {
        return opercaoExtraCollection;
    }

    public void setOpercaoExtraCollection(List<OpercaoExtra> opercaoExtraCollection) {
        this.opercaoExtraCollection = opercaoExtraCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (operacaoExtraTipoId != null ? operacaoExtraTipoId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OperacaoExtraTipo)) {
            return false;
        }
        OperacaoExtraTipo other = (OperacaoExtraTipo) object;
        if ((this.operacaoExtraTipoId == null && other.operacaoExtraTipoId != null) || (this.operacaoExtraTipoId != null && !this.operacaoExtraTipoId.equals(other.operacaoExtraTipoId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return getNome();
    }

}
